package com.example.newnoke.ui;

import android.os.Bundle;
import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.example.newnoke.R;
import com.example.newnoke.data.TeamData;
import com.example.newnoke.mvp.presenter.ZhuanPresenter;
import com.example.newnoke.mvp.view.IZhuanV;
import com.example.newnoke.utils.API;
import com.geya.jbase.baseactivity.BaseRVActivity;
import com.geya.jbase.constant.RequestType;

import java.util.HashMap;
import java.util.List;

public class TeamActivity extends BaseRVActivity <TeamData.DataBean, ZhuanPresenter> implements IZhuanV {



    @Override
    public ZhuanPresenter newP() {
        return new ZhuanPresenter(this);
    }


    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mImmersionBar.init();
          setContentView(R.layout.activity_list);

        initBaseView();

        mTitleButton.setTitles(getIntent().getStringExtra("name"));
        initRV(0,0);
        mSwipeToLoadLayout.setLoadMoreEnabled(false);
        mSwipeToLoadLayout.setRefreshEnabled(false);
        HashMap<String,Object> map = new HashMap<>();
        map.put("type",getIntent().getStringExtra("type"));
        requestData(RequestType.OKGO_POST,RequestType.ADDRESS, API.CHILD_GROUP, TeamData.class,map);
    }
    @Override
    public Class setClass() {
        return TeamData.DataBean.class;
    }

    @Override
    public BaseQuickAdapter initAdapter(List<TeamData.DataBean> list) {
        return new BaseQuickAdapter<TeamData.DataBean,BaseViewHolder>(R.layout.item_list_team,list) {

            @Override
            protected void convert(BaseViewHolder helper, TeamData.DataBean item) {
                helper.setText(R.id.name,item.getMobile())
                        .setTextColor(R.id.type,item.getStatus()==1?0xFF00a2ff:0xFFff0000)
                        .setText(R.id.type,item.getStatus()==1?"有效":"无效");

            }
        };
    }

    @Override
    public void pay(String s, boolean bl) {

    }
}
